<% provide(:title, "Edit Task") %>

<h1>Editing Micropost</h1>

<% if @micropost.errors.any? %>
<div id="error_explanation">
<div class="alert alert-danger">

  <%= pluralize(@micropost.errors.count, "error") %> prohibited this micropost from being saved
</div>
  <ul>
  <% @micropost.errors.full_messages.each do |message| %>
    <li><%= message %></li>
  <% end %>
  </ul>
</div>
<% end %>

<div class="row">
  <div class="col-md-6 col-md-offset-3">
    <%= form_for(@micropost) do |form| %>


    <%= form.label :category, "大类" %>
    <%= form.collection_select :category_id, Category.order(:name), :id, :name, :prompt => 'Select One', class: 'form-control' %>

    <%= form.label :subcategory, "分类" %>
    <%= form.grouped_collection_select :subcategory_id, Category.order(:name), :subcategories, :name, :id, :name, :prompt => 'Select One', class: 'form-control' %>


      <%= form.label :task, "任务" %>
      <%= form.text_area :task, class: 'form-control' %>
  
      <%= form.label :cost, "工时 (小时) " %>
      <%= form.number_field :cost, class: 'form-control', step: :any %>
  
  
  
      <%= form.label :date %>
      <%= form.date_field :date, class: 'form-control' %>
  
      <%= form.submit "submit", class: 'btn btn-primary' %>
    <% end %>


  </div>
</div>

